﻿@using System.Data;
@using System.Web;
@using DTcms.Web.MVC.Areas.Web.Controllers;
@using DTcms.Web.MVC.UI.Controllers;
@using DTcms.Model;
@{
   Layout = "~/Areas/Web/Views/" + ViewBag.TemplateSkin + "/Shared/_LayoutShow.cshtml";
   DTcms.Model.sites site = ViewData["site"] as DTcms.Model.sites;
   DTcms.Model.sysconfig config = ViewData["sysConfig"] as DTcms.Model.sysconfig;
   DTcms.Model.article m = ViewData["model"] as DTcms.Model.article;
   Article_ShowController bc = ViewBag.This as Article_ShowController;
   string category_title = bc.get_category_title(m.category_id, "新闻资讯");
   ViewBag.Title = m.title + " - " + category_title +" - " + site.name;
   string channel = "news";
}

<!--当前位置-->
@{string category_nav = bc.get_category_menu("news_list", m.category_id);}
<div class="section">
  <div class="location">
    <span>当前位置：</span>
    <a href="@bc.linkurl("index")">首页</a> &gt;
        <a href="@bc.linkurl("news")">新闻资讯</a>
    @Html.Raw(category_nav)
  </div>
</div>
<!--/当前位置-->

<div class="section">
  <!--/页面右边-->
  <div class="right-260">
    <div class="bg-wrap nobg">
      <div class="sidebar-box">
        <h4>资讯类别</h4>
        <ul class="navbar">
          @{DataTable categoryList1 = bc.get_category_child_list(channel, 0);}
          @foreach (DataRow cdr1 in categoryList1.Rows) {
            <li>
              <h5><a href="@bc.linkurl("news_list", cdr1["id"])">@cdr1["title"]</a></h5>
              <p>
                @{DataTable categoryList2 = bc.get_category_child_list(channel, Convert.ToInt32(cdr1["id"]));}
                @foreach (DataRow cdr2 in categoryList2.Rows) {
                  if (Convert.ToInt32(cdr2["id"]) == m.category_id) {
                  <a href="@bc.linkurl("news_list", cdr2["id"])" class="selected">@cdr2["title"]</a>
                  }
                  else {
                  <a href="@bc.linkurl("news_list", cdr2["id"])">@cdr2["title"]</a>
                  }
                }
              </p>
            </li>
          }
        </ul>
      </div>

      <div class="sidebar-box">
        <h4>图片新闻</h4>
        <ul class="side-img-list">
          @{DataTable redNews = bc.get_article_list(channel, 0, 4, "status=0 and is_red=1 and img_url<>''");}
          @foreach (DataRow dr in redNews.Rows) {
            <li>
              <div class="img-box">
                <img src="@dr["img_url"]" />
              </div>
              <div class="txt-box">
                <a href="@bc.linkurl("news_show", dr["id"])">@dr["title"]</a>
                <span>@DateTime.Parse(dr["add_time"].ToString()).ToString("yyyy-MM-dd")</span>
              </div>
            </li>
          }
        </ul>
      </div>

      <div class="sidebar-box">
        <h4>阅读排行</h4>
        <ul class="txt-list">
          @{DataTable hotNews = bc.get_article_list(channel, 0, 10, "status=0", "click desc,id desc");}
          @for (int i = 0; i < hotNews.Rows.Count; i++) {
            DataRow hotdr = hotNews.Rows[i];
            <li>
              @if (i < 1) {
                <label class="hot">@(i + 1)</label>
              }
              else {
                <label>@(i + 1)</label>
              }
              <a href="@bc.linkurl("news_show", hotdr["id"])">@hotdr["title"]</a>
            </li>
          }
        </ul>
      </div>

    </div>
  </div>
  <!--/页面右边-->

  <!--页面左边-->
  <div class="left-auto">
    <div class="bg-wrap">
      <div class="meta">
        <h2>@m.title</h2>
        <div class="info">
          <span><i class="iconfont icon-date"></i>@m.add_time</span>
          <span><i class="iconfont icon-comment"></i>
            <script type="text/javascript" src="@(config.webpath)tools/submit_ajax.ashx?action=view_comment_count&channel_id=@m.channel_id&id=@m.id"></script>
            人评论</span>
          <span><i class="iconfont icon-view"></i>
            <script type="text/javascript" src="@(config.webpath)tools/submit_ajax.ashx?action=view_article_click&channel_id=@m.channel_id&id=@m.id&click=1"></script>
            次</span>
        </div>
        <div class="note">
          <p>@Html.Raw(m.zhaiyao)</p>
        </div>
      </div>
      <div class="entry">
        @Html.Raw(m.content)
      </div>

      <!--上下一条-->
      <div class="next-box clearfix">
        <p class="prev">上一篇：@Html.Raw(bc.get_prevandnext_article("news_show", -1, "没有了", 0))</p>
        <p class="next">下一篇：@Html.Raw(bc.get_prevandnext_article("news_show", 1, "没有了", 0))</p>
      </div>
      <!--/上下一条-->

      <!--相关资讯-->
      <div class="rel-box">
        <h2 class="slide-tit">
          <span>相关资讯</span>
        </h2>
        <ul class="rel-list">
          @{DataTable relNews = bc.get_article_list(channel, m.category_id, 4, "is_red=1 and img_url<>'' and id<>" + m.id);}
          @foreach (DataRow dr in relNews.Rows) {
            <li>
              <div class="img-box">
                <a title="@dr["title"]" href="@bc.linkurl("news_show", dr["id"])">
                  <img src="@dr["img_url"]">
                </a>
              </div>
              <div class="info">
                <h3><a title="@dr["title"]" href="@bc.linkurl("news_show", dr["id"])">@dr["title"]</a></h3>
                <p>@dr["zhaiyao"]</p>
                <span>@dr["add_time"]</span>
              </div>
            </li>
          }
          @if (relNews.Rows.Count < 1) {
            <div class="nodata">暂无相关的数据...</div>
          }
        </ul>
      </div>
      <!--/相关资讯-->

      <!--网友评论-->
      <div class="comment-box">
        <h2 class="slide-tit">
          <strong>共有<script type="text/javascript" src="@(config.webpath)tools/submit_ajax.ashx?action=view_comment_count&channel_id=@m.channel_id&id=@m.id"></script>条评论</strong>
          <span>网友评论</span>
        </h2>
        @RenderPage("~/Areas/Web/Views/" + site.build_path + "/Shared/partial_comment_box.cshtml")
      </div>
      <!--/网友评论-->

    </div>
  </div>
  <!--/页面左边-->
</div>
